<?php /*
	
*/ ?>
<?php
include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['memberid']))
{
header("location:customerlogin.php?cond=newsletter");
die();
}

if(isset($_SESSION['memberid']) && ($_SESSION['memberid'])!="")
{
		$memid =  $_SESSION['memberid'];
		//echo $memid;
		
		$sql = "select * from tblcustomers where intcusid ='$memid'";
		
		$result = $n02586916_db->select($sql);
		if(count($result)<=0)
		{
			echo " No Record Found!<br>";
			die();
		}
		if($result)
		{
			foreach($result as $row)
			{
				$news = $row['intnewsletter'];
				
				//$action=2;
			}
		}
		if(isset($_REQUEST['Submit']) && trim($_REQUEST['Submit']) == "Submit")
		{
			//print_r($_REQUEST);
			
			if(isset($_REQUEST['news']))
			{
			$news = "1";
			}
			else{$news="0";}
			$sql_upd ="UPDATE tblcustomers SET 
			  intnewsletter = '$news' 
			  WHERE intcusid ='$memid'";
			echo $sql_upd;
			//die();
			$result = $n02586916_db->sql_query($sql_upd);
			//$action=1;
			
			header("location:custnewsletter.php?msg=ursoufnl");
			die();
		}
	
}

?>
<?php include("inc/head.inc.php") ?>
<body>
<form name="acco" action="" method="post">
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php") ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php") ?></td>
        <td valign="top">
		<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr>
          <td height="23" class="head"><div class="pageheader">Newsletter Subscription</div></td>
        </tr>
		
        <tr>
          <td align="center"><span class="fontsmall">
            <?php 
  if(isset($_REQUEST['msg']))
  {
  echo $mess[$_REQUEST['msg']]; 
  }
  ?>
          </span></td>
        </tr>
        <tr>
          <td valign="top">
		  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" class="prborderbg" id="forgetpass">
                        <tr>
                          <td height="22" colspan="3" align="left" class="search">&nbsp;&nbsp; My Newsletter Subscription </td>
                        </tr>
                        <tr>
                          <td width="13%" align="center" class="fontsmall">
						  <?php
						if(isset($_SESSION['memberid']) && ($_SESSION['memberid'])!="")
						{
							$memid =  $_SESSION['memberid'];
							//echo $memid;
							
							$sql = "select * from tblcustomers where intcusid ='$memid'";
							
							$result = $n02586916_db->select($sql);
							if($result)
							{
								$new=$result[0]['intnewsletter'];
								
						  ?>
						  
						  <input name="news" type="checkbox" id="news" value="<?php echo $news;?>"<?php if($news=='1'){echo 'checked';}else{echo '';}?> />
						  <?php }}?>
						  </td>
                          <td width="31%" class="fontsmall"><strong class="font">General Newsletter </strong></td>
                          <td width="56%"><!--<input name="action" type="hidden" id="action" value="1" />-->                          </td>
                        </tr>
                        <tr>
                          <td colspan="3" align="center" class="font">Including store news, new products, special offers, and other promotional announcements.</td>
                        </tr>
                        <tr>
                          <td colspan="3" align="center">
						  <input name="Submit" type="submit" class="btn" value="Submit"/>                          </td>
                        </tr>
            </table></td>
        </tr> 
      </table>		</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</form>
</body>
</html>
